﻿using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using HybridLab.Virtual.Interfaces;

namespace HybridLab.Virtual.UnitTests
{
	[TestClass]
	public class HyperVTests
	{
		[TestMethod]
		[Ignore]
		public void TestConnect()
		{
			var host = VirtualHostCatalog.GetHost("HyperV", "localhost");

			var vms = host.GetVMs();
			Assert.AreEqual(9, vms.Count);

			var test = vms.Single(v => v.Name.Equals("TestVM", StringComparison.OrdinalIgnoreCase));
			Assert.AreEqual(2, test.Snapshots.Count);

			test.CreateSnapshot("Testing_");
			Assert.AreEqual(3, test.Snapshots.Count);
			test.ApplySnapshot("Clean");

			var web = vms.Single(v => v.Name.Equals("WebServer", StringComparison.OrdinalIgnoreCase));
			Assert.AreEqual("Webserver", web.DnsName);
		}
	}
}
